package com.example.springevent.ivd.web;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.example.springevent.common.CommonResponse;
import com.example.springevent.ivd.domain.InvoiceVerifyDetail;
import com.example.springevent.ivd.service.IvdServiceI;

@RestController
@RequestMapping("/ivd")
public class IvdController {
	@Autowired
	private IvdServiceI ivdService;

	private static final Logger log = LoggerFactory.getLogger(IvdController.class);

	@PostMapping("addIvd")
	public CommonResponse<InvoiceVerifyDetail> addIvd(@RequestBody InvoiceVerifyDetail ivd) {
		ivdService.addIvd(ivd);
		return CommonResponse.success(ivd);
	}

	@PostMapping("addIvdInTran")
	public CommonResponse<InvoiceVerifyDetail> addIvdInTran(@RequestBody InvoiceVerifyDetail ivd) {
		ivdService.addIvdInTran(ivd);
		return CommonResponse.success(ivd);
	}

	@DeleteMapping
	public CommonResponse<InvoiceVerifyDetail> remove(@RequestBody InvoiceVerifyDetail ivd) {
		ivdService.removeIvd(ivd);
		return CommonResponse.success(ivd);
	}
}
